- placeholders = { strong_start: '<strong>'.html_safe,
  strong_end: '</strong>'.html_safe,
  project_or_group_name: member_source.human_name,
  project_or_group: member_source.model_name.singular,
  br_tag: '<br/>'.html_safe,
  role: member.human_access.downcase }
- join_text =  s_('InviteEmail|Join now')
- inviter_name = member.created_by.name if member.created_by
- join_url = invite_url(@token, invite_type: Emails::Members::INITIAL_INVITE)

= content_for :preview_text do
  %div{ style: "display:none;font-size:1px;line-height:1px;max-height:0px;max-width:0px;opacity:0;overflow:hidden;" }
    - if member.created_by
      = s_('InviteEmail|Join your team on GitLab! %{inviter} invited you to %{project_or_group_name}') % { inviter: inviter_name, project_or_group_name: placeholders[:project_or_group_name] }
    - else
      = s_('InviteEmail|Join your team on GitLab! You are invited to %{project_or_group_name}') % { project_or_group_name: placeholders[:project_or_group_name] }
  = gmail_goto_action(join_text, join_url)

%tr
  %td.text-content{ colspan: 2 }
    %img.mail-avatar{ height: "60", src: avatar_icon_for_user(member.created_by, 60, only_path: false), width: "60", alt: "" }
    %p
      - if member.created_by
        = html_escape(s_("InviteEmail|%{inviter} invited you to join the %{strong_start}%{project_or_group_name}%{strong_end}%{br_tag}%{project_or_group} as a %{role}")) % placeholders.merge({ inviter: (link_to inviter_name, user_url(member.created_by)).html_safe })
        - if member.tasks_to_be_done.present?
          = s_("InviteEmail|and has assigned you the following tasks:")
          %ul.list-style-position-inside
            - member.tasks_to_be_done.each do |task|
              %li= localized_tasks_to_be_done_choices[task]
      - else
        = html_escape(s_("InviteEmail|You are invited to join the %{strong_start}%{project_or_group_name}%{strong_end}%{br_tag}%{project_or_group} as a %{role}")) % placeholders
    %p.invite-actions
      = link_to join_text, join_url, class: 'invite-btn-join'
%tr.border-top
  %td.text-content.mailer-align-left.half-width
    %h4
      = s_('InviteEmail|%{project_or_group} details') % { project_or_group: member_source.model_name.singular.capitalize }
    %ul
      %li
        %div
          %img.mailer-icon{ alt: '', src: image_url("mailers/members/users.png") }
          %span
            - member_count = member_source.members.size
            = n_('%{bold_start}%{count}%{bold_end} member', '%{bold_start}%{count}%{bold_end} members',
              member_count).html_safe % { count: number_with_delimiter(member_count),
              bold_start: '<b>'.html_safe,
              bold_end: '</b>'.html_safe }
      %li
        %div
          %img.mailer-icon{ alt: '', src: image_url("mailers/members/issues.png") }
          %span
            - issue_count = member_source.open_issues_count(member.created_by)
            = n_('%{bold_start}%{count}%{bold_end} issue', '%{bold_start}%{count}%{bold_end} issues',
              issue_count).html_safe % { count: number_with_delimiter(issue_count),
              bold_start: '<b>'.html_safe,
              bold_end: '</b>'.html_safe }
      %li
        %div
          %img.mailer-icon{ alt: '', src: image_url("mailers/members/merge-request-open.png") }
          %span
            - mr_count = member_source.open_merge_requests_count(member.created_by)
            = n_('%{bold_start}%{count}%{bold_end} opened merge request', '%{bold_start}%{count}%{bold_end} opened merge requests',
              mr_count).html_safe % { count: number_with_delimiter(mr_count),
              bold_start: '<b>'.html_safe,
              bold_end: '</b>'.html_safe }
  %td.text-content.mailer-align-left.half-width
    %h4
      = s_("InviteEmail|What's it about?")
    %p
      = invited_to_description(member_source)
